package com.example.demo.service;

import com.auth0.jwt.JWT;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.example.demo.dao.AdminDao;
import com.example.demo.dao.ResourceDao;
import com.example.demo.pojo.Admin;
import com.example.demo.pojo.User;

@Service("adminService")
@Transactional
public class AdminServiceImpl implements AdminService {
	@Autowired
	private AdminDao adminDao;
	
	@Override
	public String loginCheck(Admin admin) {
		// TODO Auto-generated method stub
		System.out.println("管理员登录...");
//		返回信息
		String backInfo = null;
		String result;
		String adminAccount;
		String adminPassword;

		Admin adminInfo=new Admin();
		//将账号密码放入admin对象中
		adminInfo.setAdminAccount(admin.getAdminAccount());
		adminInfo.setAdminPassword(admin.getAdminPassword());
		//赋予对应变量
		adminAccount=admin.getAdminAccount();
		adminPassword=admin.getAdminPassword();
		//输出查看
		System.out.println(adminInfo);
		backInfo=adminDao.loginCheck(adminAccount,adminPassword);
		//输出查看返回信息
		System.out.println(backInfo);
		if(backInfo!=null) {
			//返回成功
			result="ok";
		}else {
			//返回失败
			result="not";
		}
		return result;
	}

}
